package gaileenchess.tests;
import gaileenchess.*;

public class QueenTest extends Test
{
    public QueenTest()
    {
        super("Queen");
    }
    
    protected boolean doTests()
    {
        return test1();
    }

    private static Piece[][] boardConfig1()
    {
        Piece[][] pos = new Piece[8][8];

        /*

            a    b    c    d    e    f    g    h  
           ---- ---- ---- ---- ---- ---- ---- ----
        8 |    | BN |    |    |    |    | BN |    | 7
           ---- ---- ---- ---- ---- ---- ---- ----
        7 |    |    | BP | BP |    | BP |    |    | 6
           ---- ---- ---- ---- ---- ---- ---- ----
        6 |    |    |    |    | BP |    |    |    | 5
           ---- ---- ---- ---- ---- ---- ---- ----
        5 |    |    |    | WB | BQ |    |    |    | 4
           ---- ---- ---- ---- ---- ---- ---- ----
        4 |    |    |    |    |    |    |    |    | 3
           ---- ---- ---- ---- ---- ---- ---- ----
        3 |    | WP |    |    |    |    |    |    | 2
           ---- ---- ---- ---- ---- ---- ---- ----
        2 | WP |    |    | WP |    |    | WP |    | 1
           ---- ---- ---- ---- ---- ---- ---- ----
        1 |    | WN |    |    |    |    |    |    | 0
           ---- ---- ---- ---- ---- ---- ---- ----
            0    1    2    3    4    5    6    7


        */

        Board.addPiece(pos, new Knight(Common.Side.WHITE, 0, 1));
        Board.addPiece(pos, new Pawn(Common.Side.WHITE, 1, 0));
        Board.addPiece(pos, new Pawn(Common.Side.WHITE, 1, 3));
        Board.addPiece(pos, new Pawn(Common.Side.WHITE, 1, 6));
        Board.addPiece(pos, new Pawn(Common.Side.WHITE, 2, 1));

        Board.addPiece(pos, new Bishop(Common.Side.WHITE, 4, 3));

        // TODO


        Board.addPiece(pos, new Queen(Common.Side.BLACK, 4, 4));
        Board.addPiece(pos, new Pawn(Common.Side.BLACK, 5, 4));
        Board.addPiece(pos, new Pawn(Common.Side.BLACK, 6, 2));
        Board.addPiece(pos, new Pawn(Common.Side.BLACK, 6, 3));
        Board.addPiece(pos, new Pawn(Common.Side.BLACK, 6, 5));
        Board.addPiece(pos, new Knight(Common.Side.BLACK, 7, 1));
        Board.addPiece(pos, new Knight(Common.Side.BLACK, 7, 6));

        return pos;
    }

    private boolean test1()
    {
        boolean pass = true;

        Piece[][] boardConfig = boardConfig1();
        Board board = new Board(boardConfig);

        // TODO

        Piece whiteQueen = boardConfig[4][3];
        Board.Position pos = new Board.Position(4, 3);

        pass &= (whiteQueen.getType() == Piece.Type.QUEEN);
        pass &= (whiteQueen.getSide() == Common.Side.WHITE);
        pass &= (whiteQueen.getRow() == 4 && whiteQueen.getCol() == 3);

        pass &= whiteQueen.isValidMove(Common.Side.WHITE, board, pos, new Board.Position(5,4));

        // TODO
        
        printSuccess(pass, "test1");
        
        return pass;
    }
}
